package com.parfinex.java.phase1.module2.task08;

public class Dog extends Animal {
    private int tooth;

    public Dog() {
        super();
    }

    public Dog(String name, String color, int tooth) {
        super(name, color);
        setTooth(tooth);
//        this.tooth = tooth;
    }

    public int getTooth() {
        return tooth;
    }

    public void setTooth(int tooth) {
        if(tooth>0) {
            this.tooth = tooth;
        }else {
            System.out.println("牙齿数量不合理哦！");
        }
    }

    @Override
    public void show() {
        super.show();
        System.out.println("牙齿数量是："+getTooth());
    }
}
